package com.yanqu.road.entity.activity.langyamemorial.config;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.utils.RandomHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class LangYaMemorialConfig {

    private ActivityInfo activityInfo;

    public LangYaMemorialConfig(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    private List<LangYaMemorialAtticInfo> atticInfoList;
    /**
     * 积分道具id
     */
    private int EXCHANGE_SCORE_ITEM_ID;

    //修复消耗
    private String repairProp;

    //建阁消耗
    private String atticConsume;

    //建阁消耗(十连)
    private String atticTenConsume;

    //建阁(十连),开启条件
    private int atticTenConsumeCond;

    //建阁积分
    private int atticIntegral;

    //建阁祭奠值
    private String atticSacrificialPoints;

    //上下滑动螺层查看层数
    private int atticView;

    //孔明灯奖励
    private String kongmingReward;

    //黄金阁保底机制
    private int goldFloors;

    //黄金阁概率千分比
    private int goldProbability;

    private String ATTIC_NPC_NAME;

    private String LANGYA_ITEM_RETURN;

    public int getBuildValue(int buildType){
        List<Integer> list = StringUtils.stringToIntegerList(atticSacrificialPoints, "\\|");
        if(buildType == 1){
            return list.get(0);
        }else if(buildType == 2){
            return list.get(1);
        }
        return 0;
    }

    public LangYaMemorialAtticInfo random(int type, Random random){
        List<LangYaMemorialAtticInfo> tempList = new ArrayList<>();
        for (LangYaMemorialAtticInfo atticInfo : atticInfoList) {
            if(type == atticInfo.getId()){
                tempList.add(atticInfo);
            }
        }
        List<Integer> weightList = new ArrayList<>();
        for (LangYaMemorialAtticInfo atticInfo : tempList) {
            weightList.add(Integer.parseInt(atticInfo.getTrueWeight()));
        }

        int idx = RandomHelper.getRandomIndexByWeight(weightList, random);
        return tempList.get(idx);
    }


    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public void setActivityInfo(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public void setAtticInfoList(List<LangYaMemorialAtticInfo> atticInfoList) {
        this.atticInfoList = atticInfoList;
    }

    public int getEXCHANGE_SCORE_ITEM_ID() {
        return EXCHANGE_SCORE_ITEM_ID;
    }

    public void setEXCHANGE_SCORE_ITEM_ID(int EXCHANGE_SCORE_ITEM_ID) {
        this.EXCHANGE_SCORE_ITEM_ID = EXCHANGE_SCORE_ITEM_ID;
    }

    public String getRepairProp() {
        return repairProp;
    }

    public void setRepairProp(String repairProp) {
        this.repairProp = repairProp;
    }

    public String getAtticConsume() {
        return atticConsume;
    }

    public void setAtticConsume(String atticConsume) {
        this.atticConsume = atticConsume;
    }

    public int getAtticIntegral() {
        return atticIntegral;
    }

    public void setAtticIntegral(int atticIntegral) {
        this.atticIntegral = atticIntegral;
    }

    public String getAtticSacrificialPoints() {
        return atticSacrificialPoints;
    }

    public void setAtticSacrificialPoints(String atticSacrificialPoints) {
        this.atticSacrificialPoints = atticSacrificialPoints;
    }

    public int getAtticView() {
        return atticView;
    }

    public void setAtticView(int atticView) {
        this.atticView = atticView;
    }

    public String getKongmingReward() {
        return kongmingReward;
    }

    public void setKongmingReward(String kongmingReward) {
        this.kongmingReward = kongmingReward;
    }

    public int getGoldFloors() {
        return goldFloors;
    }

    public void setGoldFloors(int goldFloors) {
        this.goldFloors = goldFloors;
    }

    public int getGoldProbability() {
        return goldProbability;
    }

    public void setGoldProbability(int goldProbability) {
        this.goldProbability = goldProbability;
    }

    public List<LangYaMemorialAtticInfo> getAtticInfoList() {
        return atticInfoList;
    }

    public String getAtticTenConsume() {
        return atticTenConsume;
    }

    public void setAtticTenConsume(String atticTenConsume) {
        this.atticTenConsume = atticTenConsume;
    }

    public int getAtticTenConsumeCond() {
        return atticTenConsumeCond;
    }

    public void setAtticTenConsumeCond(int atticTenConsumeCond) {
        this.atticTenConsumeCond = atticTenConsumeCond;
    }

    public String getATTIC_NPC_NAME() {
        return ATTIC_NPC_NAME;
    }

    public void setATTIC_NPC_NAME(String ATTIC_NPC_NAME) {
        this.ATTIC_NPC_NAME = ATTIC_NPC_NAME;
    }

    public String getLANGYA_ITEM_RETURN() {
        return LANGYA_ITEM_RETURN;
    }

    public void setLANGYA_ITEM_RETURN(String LANGYA_ITEM_RETURN) {
        this.LANGYA_ITEM_RETURN = LANGYA_ITEM_RETURN;
    }
}
